package com.project.controller;

import com.github.pagehelper.PageInfo;
import com.project.bean.MainStickerBean;
import com.project.bean.UserBean;
import com.project.service.IChanelService;
import com.project.service.IMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;


@RestController
@RequestMapping("main")
public class MainController {
    @Autowired
    private IMainService service;
    @Autowired
    private IChanelService services;
    @RequestMapping("findByItem")
    public PageInfo<MainStickerBean> findByItem(int pageNum,String name, String author,
                                               int chanelId ,LocalDate startDate, LocalDate endDate){
        return service.findByItem(pageNum,chanelId,name,author,startDate,endDate);
    }
    @RequestMapping("add")
    public String add(String title, String author, String content, int channelId){
        MainStickerBean mainSticker = new MainStickerBean(title,author,content,channelId);
        service.add(mainSticker);
        return "ok";
    }

}
